home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / GIMP 2.6.8 / gimp-2.6.8-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / chip-away.scm < prev    next >
Text File  |  2009-12-15  |  8KB  |  207 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ;  Supposed to look vaguely like roughly carved wood. Chipped away if you will.
  5. ;
  6. ;  Options: Text String - the string to make the logo from
  7. ;           Font        - which font to use
  8. ;           Font Size   - how big
  9. ;           Chip Amount - how rought he chipping is (how spread the bump map is)
  10. ;           Blur Amount - the bump layer is blurred slighty by this amount
  11. ;           Invert      - whether or not to invert the bumpmap (gives a carved in feel)
  12. ;           Drop Shadow - whether or not to draw a drop shadow
  13. ;           Keep bump layer? - whether to keep the layer used as the bump map
  14. ;           fill bg with pattern? - whether to fill the background with the pattern or leave it white
  15. ;           Keep Background - whether or not to remove the background layer
  16. ;
  17. ;  Adrian Likins  (Adrian@gimp.org)
  18. ;  Jan 11, 1998 v1
  19. ;
  20. ;  see http://www.gimp.org/~adrian/script.html
  21. ;
  22. ; This program is free software; you can redistribute it and/or modify
  23. ; it under the terms of the GNU General Public License as published by
  24. ; the Free Software Foundation; either version 2 of the License, or
  25. ; (at your option) any later version.
  26. ;
  27. ; This program is distributed in the hope that it will be useful,
  28. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  30. ; GNU General Public License for more details.
  31. ;
  32. ; You should have received a copy of the GNU General Public License
  33. ; along with this program; if not, write to the Free Software
  34. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  35. ;
  36. ;  Some suggested patterns: Dried mud, 3D green, Slate
  37. ;
  38.  
  39. (define (apply-chip-away-logo-effect img
  40.                                      logo-layer
  41.                                      spread-amount
  42.                                      blur-amount
  43.                                      invert
  44.                                      drop-shadow
  45.                                      keep-bump
  46.                                      bg-fill
  47.                                      keep-back
  48.                                      pattern)
  49.   (let* (
  50.         (width (car (gimp-drawable-width logo-layer)))
  51.         (height (car (gimp-drawable-height logo-layer)))
  52.         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  53.         (bump-layer (car (gimp-layer-new img width height RGBA-IMAGE "Bump Layer" 100 NORMAL-MODE)))
  54.         )
  55.  
  56.     (gimp-context-push)
  57.  
  58.     (script-fu-util-image-resize-from-layer img logo-layer)
  59.     (script-fu-util-image-add-layers img bump-layer bg-layer)
  60.     (gimp-layer-set-lock-alpha logo-layer TRUE)
  61.     (gimp-context-set-pattern pattern)
  62.  
  63.     (gimp-context-set-background '(255 255 255))
  64.     (gimp-selection-all img)
  65.  
  66.     (if (= bg-fill TRUE)
  67.         (gimp-edit-bucket-fill bg-layer
  68.                                PATTERN-BUCKET-FILL NORMAL-MODE
  69.                                100 255 FALSE 1 1)
  70.         (gimp-edit-fill bg-layer BACKGROUND-FILL)
  71.     )
  72.  
  73.     (gimp-selection-all img)
  74.     (gimp-edit-clear bump-layer)
  75.     (gimp-selection-none img)
  76.     (gimp-selection-layer-alpha logo-layer)
  77.     (gimp-edit-fill bump-layer BACKGROUND-FILL)
  78.     (gimp-edit-bucket-fill logo-layer
  79.                            PATTERN-BUCKET-FILL NORMAL-MODE 100 255 FALSE 1 1)
  80.     (gimp-selection-none img)
  81.  
  82.     (gimp-layer-set-lock-alpha bump-layer FALSE)
  83.     (plug-in-spread RUN-NONINTERACTIVE img bump-layer spread-amount spread-amount)
  84.     (gimp-selection-layer-alpha bump-layer)
  85.     (plug-in-gauss-rle RUN-NONINTERACTIVE img bump-layer blur-amount TRUE TRUE)
  86.  
  87.     (gimp-selection-none img)
  88.  
  89.     (plug-in-bump-map RUN-NONINTERACTIVE img logo-layer bump-layer
  90.                       135.00 25.0 60 0 0 0 0 TRUE invert 1)
  91.  
  92.     (gimp-drawable-set-visible bump-layer FALSE)
  93.  
  94.      (if (= drop-shadow TRUE)
  95.         (begin
  96.           (let* ((shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow layer" 100 NORMAL-MODE))))
  97.             (gimp-image-set-active-layer img logo-layer)
  98.             (script-fu-util-image-add-layers img shadow-layer)
  99.             (gimp-selection-all img)
  100.             (gimp-edit-clear shadow-layer)
  101.             (gimp-selection-none img)
  102.             (gimp-selection-layer-alpha logo-layer)
  103.             (gimp-context-set-background '(0 0 0))
  104.             (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  105.             (gimp-selection-none img)
  106.             (plug-in-gauss-rle RUN-NONINTERACTIVE img shadow-layer 5 TRUE TRUE)
  107.             (gimp-layer-translate shadow-layer 6 6))))
  108.  
  109.      (if (= keep-bump FALSE)
  110.          (gimp-image-remove-layer img bump-layer))
  111.  
  112.      (if (= keep-back FALSE)
  113.          (gimp-image-remove-layer img bg-layer))
  114.  
  115.     (gimp-context-pop)
  116.   )
  117. )
  118.  
  119. (define (script-fu-chip-away-logo-alpha img
  120.                                         logo-layer
  121.                                         spread-amount
  122.                                         blur-amount
  123.                                         invert
  124.                                         drop-shadow
  125.                                         keep-bump
  126.                                         bg-fill
  127.                                         keep-back
  128.                                         pattern)
  129.   (begin
  130.     (gimp-image-undo-group-start img)
  131.     (apply-chip-away-logo-effect img logo-layer spread-amount blur-amount
  132.                                  invert drop-shadow keep-bump bg-fill
  133.                                  keep-back pattern)
  134.     (gimp-image-undo-group-end img)
  135.     (gimp-displays-flush)
  136.   )
  137. )
  138.  
  139. (script-fu-register "script-fu-chip-away-logo-alpha"
  140.   _"Chip Awa_y..."
  141.   _"Add a chipped woodcarving effect to the selected region (or alpha)"
  142.   "Adrian Likins <adrian@gimp.org>"
  143.   "Adrian Likins <adrian@gimp.org>"
  144.   "1997"
  145.   "RGBA"
  146.   SF-IMAGE      "Image"                 0
  147.   SF-DRAWABLE   "Drawable"              0
  148.   SF-ADJUSTMENT _"Chip amount"          '(30 0 200 1 10 0 1)
  149.   SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
  150.   SF-TOGGLE     _"Invert"               FALSE
  151.   SF-TOGGLE     _"Drop shadow"          TRUE
  152.   SF-TOGGLE     _"Keep bump layer"      FALSE
  153.   SF-TOGGLE     _"Fill BG with pattern" TRUE
  154.   SF-TOGGLE     _"Keep background"      TRUE
  155.   SF-PATTERN    _"Pattern"              "Burlwood"
  156. )
  157.  
  158. (script-fu-menu-register "script-fu-chip-away-logo-alpha"
  159.                          "<Image>/Filters/Alpha to Logo")
  160.  
  161.  
  162. (define (script-fu-chip-away-logo text
  163.                                   font
  164.                                   font-size
  165.                                   spread-amount
  166.                                   blur-amount
  167.                                   invert
  168.                                   drop-shadow
  169.                                   keep-bump
  170.                                   bg-fill
  171.                                   keep-back
  172.                                   pattern)
  173.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  174.          (text-layer (car (gimp-text-fontname img -1 0 0
  175.                                      text 30 TRUE font-size PIXELS font))))
  176.     (gimp-image-undo-disable img)
  177.     (apply-chip-away-logo-effect img text-layer spread-amount blur-amount
  178.                                  invert drop-shadow keep-bump bg-fill
  179.                                  keep-back pattern)
  180.     (gimp-image-undo-enable img)
  181.     (gimp-display-new img)
  182.   )
  183. )
  184.  
  185. (script-fu-register "script-fu-chip-away-logo"
  186.   _"Chip Awa_y..."
  187.   _"Create a logo resembling a chipped wood carving"
  188.   "Adrian Likins <adrian@gimp.org>"
  189.   "Adrian Likins <adrian@gimp.org>"
  190.   "1997"
  191.   ""
  192.   SF-STRING     _"Text"                 "Sloth"
  193.   SF-FONT       _"Font"                 "RoostHeavy"
  194.   SF-ADJUSTMENT _"Font size (pixels)"   '(200 2 1000 1 10 0 1)
  195.   SF-ADJUSTMENT _"Chip amount"          '(30 0 200 1 10 0 1)
  196.   SF-ADJUSTMENT _"Blur amount"          '(3 1 100 1 10 1 0)
  197.   SF-TOGGLE     _"Invert"               FALSE
  198.   SF-TOGGLE     _"Drop shadow"          TRUE
  199.   SF-TOGGLE     _"Keep bump layer"      FALSE
  200.   SF-TOGGLE     _"Fill BG with pattern" TRUE
  201.   SF-TOGGLE     _"Keep background"      TRUE
  202.   SF-PATTERN    _"Pattern"              "Burlwood"
  203. )
  204.  
  205. (script-fu-menu-register "script-fu-chip-away-logo"
  206.                          "<Image>/File/Create/Logos")
  207.